package com.luo.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class PasswordEncoderUtil{
    //采用默认加密处理
    public static String encoder(String password){
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        return passwordEncoder.encode(password);
    }
    //密码匹配，用户输入密码与数据库加密密码校验
    public static boolean checkPassword(String password,String SqlPw){
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        return passwordEncoder.matches(password, SqlPw);
    }
}
